# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
from MsgProcess import MsgProcess, MsgType
from threading import Thread
import time,os

#其他插件这样调用
#self.send(MsgType=MsgType.Text, Receiver='CurrencyLamp', Data=1)#亮的时间


class CurrencyLamp(MsgProcess):

	def lamp(self,velue):
		io=37
		GPIO.setwarnings(False)
		GPIO.setmode(GPIO.BOARD)
		GPIO.setup(io,GPIO.OUT)
		GPIO.output(io,1)
		time.sleep(velue)
		GPIO.output(io,0)

	def Text(self, message):
		data= message["Data"]
		if type(data)==int or type(data)==float:
			Thread( target=lambda:self.lamp(data)).start()
